package day_2022_7_to_8.day48;

/**
 * @author haomin
 * @date 2022/08/15 22:08
 **/
public class Day30_4_Num61_PlusOne {
    class Solution {
        public int[] plusOne(int[] digits) {
            int len = digits.length;
            while(--len >= 0){
                if(digits[len] != 9){
                    digits[len]+=1;
                    return digits;
                }
                digits[len] = 0;
            }
            int[] newArr = new int[digits.length+1];
            newArr[0] = 1;
            return newArr;
        }
    }
}